package com.example.bookstore.entity

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import org.hibernate.annotations.Fetch
import org.hibernate.annotations.FetchMode
import javax.persistence.Entity
import javax.persistence.OneToMany
import javax.persistence.OneToOne
import javax.persistence.Table

/**
 * Created by IntelliJ IDEA.
 * User: lvshe
 * Date: 2019/8/10
 * Time: 18:38
 */
@Table
@Entity
class CartEntity : BaseEntity() {

    @OneToOne(optional = false, mappedBy = "cart")
    lateinit var user: UserEntity

//    @Fetch(FetchMode.JOIN)
    @OneToMany(mappedBy = "cart")
    @JsonIgnoreProperties("cart")
    var cartDetails: Set<CartDetailEntity> = emptySet()



}